﻿using Dyao.Book.Contract;
using Foundation.Entity;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace Dyao.Book.Entity
{
    [Table("Book")]
    public class BookEntity : IEntity<string>, ICreateOn, IUpdateOn, ICreateBy, IUpdateBy
    {
        /// <summary>
        /// ID
        /// </summary>
        [Required]
        [Column("Id", TypeName = "VARCHAR")]
        [Key]
        public virtual string ID { get; set; }

        /// <summary>
        /// 标题
        /// </summary>
        [Required]
        [StringLength(100)]
        [Description("书名")]
        public virtual string Title { get; set; }

        /// <summary>
        /// 描述
        /// </summary>
        [StringLength(500)]
        [Description("简介")]
        public virtual string Description { get; set; }

        /// <summary>
        /// 作者
        /// </summary>
        [StringLength(50)]
        [Description("作者")]
        public virtual string Author { get; set; }

        /// <summary>
        /// 封面图片
        /// </summary>
        [StringLength(200)]
        [Description("封面图片")]
        public virtual string CoverPicture { get; set; }

        /// <summary>
        /// 分类
        /// </summary>
        [StringLength(10)]
        [Description("分类")]
        public virtual string Category { get; set; }

        /// <summary>
        /// 子分类
        /// </summary>
        [StringLength(10)]
        [Description("子分类")]
        public virtual string SubCategory { get; set; }

        /// <summary>
        /// 爬虫Url
        /// </summary>
        [StringLength(100)]
        [Description("目录地址")]
        public virtual string SpiderUrl { get; set; }

        /// <summary>
        /// 来源书籍编号
        /// </summary>
        public virtual int SourceBookId { get; set; }

        /// <summary>
        /// 来源类型
        /// </summary>
        [Description("书籍来源")]
        public virtual BookSourceType SourceType { get; set; }

        /// <summary>
        /// 用户编号
        /// </summary>
        public virtual int CreateUserId { get; set; }

        /// <summary>
        /// 用户名称
        /// </summary>
        public virtual string CreateUserName { get; set; }

        /// <summary>
        /// 爬取时间
        /// </summary>
        [Required]
        public virtual DateTime CreateDateTime { get; set; }

        /// <summary>
        /// 用户编号
        /// </summary>
        public virtual int UpdateUserId { get; set; }

        /// <summary>
        /// 用户名称
        /// </summary>
        public virtual string UpdateUserName { get; set; }

        /// <summary>
        /// 更新时间
        /// </summary>
        [Required]
        public virtual DateTime UpdateDateTime { get; set; }

        /// <summary>
        /// 更新状态
        /// </summary>
        [Description("更新状态")]
        public virtual bool Completed { get; set; }

        /// <summary>
        /// 是否删除
        /// </summary>
        [Description("是否删除")]
        public virtual bool IsDel { get; set; }

        /// <summary>
        /// 同步章节时间
        /// </summary>
        [Description("同步章节时间")]
        public virtual DateTime? SyncChapterDate { get; set; }

        /// <summary>
        /// 是否匹配源
        /// </summary>
        [Description("是否匹配源")]
        public virtual bool IsMatchSource { get; set; }
    }
}
